package com.byzk.p2p.admin.borrow.dao;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.byzk.p2p.admin.borrow.dto.UserTender;
import com.byzk.p2p.admin.borrow.vo.AllowChangeVo;
import com.byzk.p2p.admin.borrow.vo.BorrowTenderVo;
import com.byzk.p2p.admin.borrow.vo.ChangeAwaitVo;
import com.byzk.p2p.admin.borrow.vo.MySaleChangeVo;
import com.byzk.p2p.admin.borrow.vo.SalingChangeVo;
import com.byzk.p2p.admin.borrow.vo.UserTenderExportVo;
import com.byzk.p2p.admin.borrow.vo.UserTenderVo;
import com.byzk.p2p.admin.system.vo.TenderChartVo;

public interface TenderDao {

	public Integer insert(UserTender tender);
	
	public Integer update(UserTender tender);
	
	public Integer batchUpdate(List<UserTender> listTender);
	
	public Integer batchInsert(List<UserTender> listTender);
	
	public UserTender getById(Integer id);

	public List<BorrowTenderVo> getTenderByUid(Integer uid);
	
	public Integer getUserTenderCount(UserTenderVo userTender);
	
	public List<BorrowTenderVo> getUserTender(UserTenderVo userTender);
	
	//查询
	public List<UserTenderVo> select(UserTender userTender);
	
	public List<UserTender> getByBorrowId(Integer id);
	
	public Integer count(UserTender userTender);
	
	//我的投资
	public List<UserTenderVo> myTender(UserTenderVo vo);
	//我的投资总记录数
	public Integer myTenderCount(UserTenderVo vo);
	
	public Double sumRecoverInterest(Integer userId);
	
	public Double sumAwaitInterest(Integer userId);
	
	public Double sumRecovedFund(Integer userId);
	
	public Double sumAwaitFund(Integer userId);
	
	public Double sumTenderMoney(Integer userId);
	
	public Double sumRecovedMoney(Integer userId);
	
	public Double sumAwaitTotal(Integer userId);
	
	public Integer totalCount(Integer userId);
	
	public Integer recovedCount(Integer userId);
	
	public Integer awaitCount(Integer userId);
	
	public List<AllowChangeVo> listAllowChange(UserTender tender);
	
	public List<MySaleChangeVo> listMySaleChange(@Param("userId")Integer userId);
	
	public Double getAllRecovedInterest();
	
	public List<SalingChangeVo> listSalingChange(UserTender tender);
	
	public Double getAllTenderAmount(@Param("start")Date start,@Param("end")Date end);
	
	public List<UserTender> getUserTenderGroupMonth(@Param("year") Integer year);
	
	public List<UserTenderVo> top5TenderUser();
	
	public Double sumPayTotal(Integer userId);
	
	public Double sumPayFund(Integer userId);
	
	public Double sumPayInterest(Integer userId);

	public ChangeAwaitVo sumChangeAwait(@Param("changeUserId")Integer changeUserId,@Param("changeId")Integer changeId);

	public List<UserTenderVo> myBorrowTender(@Param("borrowId")Integer borrowId);
	
	public Double sumAwaitByNotChange(Integer tenderId);
	
	public Integer countAwaitByNotChange(Integer tenderId);
	
	public Integer getMinTenderId(Integer userId);
	
	public List<TenderChartVo> groupByDate(Date date);

	public List<UserTenderVo> listByExportVo(UserTenderExportVo vo);
	
	public Double sumAmountByUserTenderVo(UserTenderVo vo);
	
	public List<BorrowTenderVo> getUserTenderList(UserTenderVo userTender);
	
	public Double getAllInvestment();
	
	public Double getAllAwait();
	
	public UserTender getByCode(String code);
	
	public int changeCount(UserTender tender);
	
	public int salingChangeCount(UserTender tender);
	
	public Double sumMoney(@Param("userId")Integer userId,@Param("borrowId")Integer borrowId);
	
	public Integer stayStillCount(Integer userId);

	public Double sumTenderAmount(Integer userId);

	public Double sumTenderInterest(Integer userId);
	
	public Integer getTenderpeopleCount();
	
	public List<UserTenderVo> listUserTenderByBorrowId(Integer borrowId);
	
	/**
	 * 
	* <p>Description:更新投资用户的待还 </p>
	* <p>Company:xbd </p>
	* @author:lilei
	* @date:2016年10月31日上午11:15:36
	 */
	public Integer updateTender(UserTender tender);
	
	/**
	 * 
	* <p>Description:查询投资用户的投资信息 </p>
	* <p>Company:xbd </p>
	* @author:lilei
	* @date:2016年10月31日上午11:16:33
	 */
	public UserTender getUserTenderInfo(UserTender tender);
	
	/**
	 * 
	* <p>Description:承接收益 </p>
	* <p>Company:xbd </p>
	* @author:lilei
	* @date:2016年11月8日下午4:26:14
	 */
	public Double sumChangeTenderInterest(Integer userId);
	
	public Integer deleteTenderUser(Map<String,Object> queryMap);
	
}

